include(${CMAKE_CURRENT_LIST_DIR}/FindZig.cmake)
if(ZIG_FOUND)
  set(CMAKE_CXX_COMPILER ${ZIG_EXECUTABLE} c++)
  set(CMAKE_C_COMPILER ${ZIG_EXECUTABLE} cc)
  set(runtime ${CMAKE_CURRENT_BINARY_DIR})
  include(${CMAKE_CURRENT_LIST_DIR}/TargetSupportsSymbolicLink.cmake)
  if(NOT TARGET_SUPPORTS_SYMBOLIC_LINK)
    include(${CMAKE_CURRENT_LIST_DIR}/TemporaryDirectory.cmake)
    if(EXISTS "${TEMPORARY_DIRECTORY}")
      string(MD5 runtime "${CMAKE_CURRENT_BINARY_DIR}")
      set(runtime "${TEMPORARY_DIRECTORY}/${runtime}")
    endif()
  endif()
  if(WIN32)
    set(CMAKE_AR ${runtime}/ar.bat)
    file(WRITE ${CMAKE_AR} "@echo off\n\"${ZIG_EXECUTABLE}\" ar %*\n")
    set(CMAKE_RANLIB ${runtime}/ranlib.bat)
    file(WRITE ${CMAKE_RANLIB} "@echo off\n\"${ZIG_EXECUTABLE}\" ranlib %*\n")
    set(CMAKE_DLLTOOL ${runtime}/dlltool.bat)
    file(WRITE ${CMAKE_DLLTOOL} "@echo off\n\"${ZIG_EXECUTABLE}\" dlltool %*\n")
  else()
    set(CMAKE_AR ${runtime}/ar)
    file(WRITE ${CMAKE_AR} "#!/usr/bin/env sh\nexec \"${ZIG_EXECUTABLE}\" ar \"$@\"\n")
    execute_process(COMMAND chmod a+rx ${CMAKE_AR})
    set(CMAKE_RANLIB ${runtime}/ranlib)
    file(WRITE ${CMAKE_RANLIB} "#!/usr/bin/env sh\nexec \"${ZIG_EXECUTABLE}\" ranlib \"$@\"\n")
    execute_process(COMMAND chmod a+rx ${CMAKE_RANLIB})
    set(CMAKE_DLLTOOL ${runtime}/dlltool)
    file(WRITE ${CMAKE_DLLTOOL} "#!/usr/bin/env sh\nexec \"${ZIG_EXECUTABLE}\" dlltool \"$@\"\n")
    execute_process(COMMAND chmod a+rx ${CMAKE_DLLTOOL})
  endif()
endif()
if(CMAKE_TOOLCHAIN_FILE)
endif()
